package pers.lx.crm.controller.info;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import pers.lx.crm.base.common.pigeon.Result;
import pers.lx.crm.entiy.info.InfoListDO;
import pers.lx.crm.entiy.info.TagBlockDO;
import pers.lx.crm.service.info.TagBlockService;

/**
 * Created by lx on 2017/3/4.
 */
@Controller
@RequestMapping(value = "tagBlock")
public class TagBlockController {

    @Autowired
    private TagBlockService tagBlockService ;

    @RequestMapping(value = "/list")
    public @ResponseBody
    Result getTagBlockList(TagBlockDO tagBlockDO){
        return tagBlockService.getTagBlocks(tagBlockDO) ;
    }

    @RequestMapping(value = "/add",method = RequestMethod.POST)
    public @ResponseBody
    Result addTagBlock(@RequestBody TagBlockDO tagBlockDO){
        return tagBlockService.addTagBlock(tagBlockDO) ;
    }

    @RequestMapping(value = "/update",method = RequestMethod.POST)
    public @ResponseBody
    Result updateTagBlock(@RequestBody TagBlockDO tagBlockDO){
        return tagBlockService.updateTagBlock(tagBlockDO) ;
    }

    @RequestMapping(value = "/remove",method = RequestMethod.POST)
    public @ResponseBody
    Result removeTagBlock(@RequestBody InfoListDO infoListDO){
        return tagBlockService.removeTagBlocks(infoListDO.getTagBlockDOs()) ;
    }

    @RequestMapping(value = "/listTag")
    public @ResponseBody
    Result getTagList(@RequestBody TagBlockDO tagBlockDO){
        return tagBlockService.getTags(tagBlockDO) ;
    }

}
